package org.zhou.springbootstudy.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.Locale;

//全面扩展MVC     所有的请求都会经过dispatcherServlet
@Configuration
public class myConfig implements WebMvcConfigurer {


//    将自己的视图解析器注入spring容器中
    @Bean
    public ViewResolver myViewResolver(){
        return new myViewResolver();
    }

//    实现了试图解析器的类 我们就可以把它看作试图解析起 ViewResolver
//    自定义了一个自己的视图解析器
    public  static class myViewResolver implements ViewResolver{
    @Override
    public View resolveViewName(String viewName, Locale locale) throws Exception {
        return null;
    }
}


    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/zhou").setViewName("test");
    }
}

